/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-04-13
 * Time: 17:29
 */
class ListNode{  // 单链表实现普通队列
    public int val;
    public ListNode next;

    public ListNode(int val){
        this.val = val;
    }
}

public class MyQueue {
    public ListNode head;
    public ListNode last;

    public void add(int val){ //入队
        ListNode node = new ListNode(val);
        if (this.head == null){
            this.head = node;
            this.last = node;
        }
        last.next = node;
        this.last = node;
    }

    public void remove(){  // 出队
        if(this.head == null){
            System.out.println("队列为空！");
        }
        System.out.println(head.val);
        this.head = this.head.next;
    }

    public int element(){
        if(this.head == null){
            System.out.println("队列为空！");
        }
        return head.val;
    }


}
